package com.hitqz.robot.biz.controller;

import com.hitqz.robot.biz.service.RobotWarningRecordService;
import com.hitqz.robot.common.core.util.R;
import com.hitqz.robot.api.business.dto.RobotClientDevicePosDto;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * 报警记录
 *
 * @author wengyongxin
 * @date 2024-05-12 03:21:06
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/client/config" )
@Tag(description = "client" , name = "执行端配置管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class RobotClientInfoController {

    private final RobotWarningRecordService robotWarningRecordService;

	/**
	 * 获取所有机器人设备点位
	 * @param clientId
	 * @return
	 */
	@Operation(summary = "所有设备点位查询" , description = "获取所有机器人设备点位" )
    @GetMapping("/device/pos/{clientId}" )
    public R<List<RobotClientDevicePosDto>> getRobotWarningRecordPage(@PathVariable(value = "clientId",required = false) String clientId ) {
		if (!Objects.equals(clientId,"all")){
			//查询指定的
		}
		//查询所有的
		List<RobotClientDevicePosDto> list = new ArrayList<>();
		RobotClientDevicePosDto dto1 = new RobotClientDevicePosDto();
		dto1.setMapCode("1kua2_map");
		dto1.setName("测试点1");
		dto1.setCode("test1");
		dto1.setPreCode("");
		dto1.setPixelX(706.04);
		dto1.setPixelY(-522.8);
		dto1.setPixelZ(0.0D);
		dto1.setType("1");
		dto1.setNavType("0");

		RobotClientDevicePosDto dto2 = new RobotClientDevicePosDto();
		dto2.setMapCode("1kua2_map");
		dto2.setName("测试点2");
		dto2.setCode("test2");
		dto2.setPreCode("test1");
		dto2.setPixelX(973.0);
		dto2.setPixelY(-424.6);
		dto2.setPixelZ(0.0D);
		dto2.setType("1");
		dto2.setNavType("0");

		RobotClientDevicePosDto dto3 = new RobotClientDevicePosDto();
		dto3.setMapCode("1kua2_map");
		dto3.setName("测试点3");
		dto3.setCode("test3");
		dto3.setPreCode("test2");
		dto3.setPixelX(936.7);
		dto3.setPixelY(-296.9);
		dto3.setPixelZ(0.0D);
		dto3.setType("1");
		dto3.setNavType("0");

		list.add(dto1);
		list.add(dto2);
		list.add(dto3);

		return R.ok(list);
    }

}